home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / wg_lib / dtfrm.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-06  |  10.2 KB  |  360 lines

  1. VERSION 2.00
  2. Begin Form DTFrm 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Date and Time"
  5.    ClientHeight    =   4020
  6.    ClientLeft      =   1965
  7.    ClientTop       =   1770
  8.    ClientWidth     =   5610
  9.    ForeColor       =   &H00000000&
  10.    Height          =   4425
  11.    Left            =   1905
  12.    LinkMode        =   1  'Source
  13.    LinkTopic       =   "Form1"
  14.    ScaleHeight     =   4020
  15.    ScaleWidth      =   5610
  16.    Top             =   1425
  17.    Width           =   5730
  18.    Begin TextBox JEnd 
  19.       BorderStyle     =   0  'None
  20.       Height          =   225
  21.       Left            =   1320
  22.       TabIndex        =   1
  23.       Top             =   3300
  24.       Width           =   1020
  25.    End
  26.    Begin TextBox JStart 
  27.       BorderStyle     =   0  'None
  28.       Height          =   225
  29.       Left            =   1320
  30.       TabIndex        =   0
  31.       Text            =   "04-01-1981"
  32.       Top             =   2835
  33.       Width           =   1020
  34.    End
  35.    Begin CommandButton JulCmd 
  36.       Caption         =   "Julian"
  37.       Height          =   315
  38.       Left            =   4185
  39.       TabIndex        =   2
  40.       Top             =   2625
  41.       Width           =   645
  42.    End
  43.    Begin Label JEndJ 
  44.       BackColor       =   &H00C0C0C0&
  45.       Height          =   225
  46.       Left            =   2520
  47.       TabIndex        =   25
  48.       Top             =   3300
  49.       Width           =   1065
  50.    End
  51.    Begin Label Label12 
  52.       BackColor       =   &H00C0C0C0&
  53.       Caption         =   "End Date:"
  54.       Height          =   225
  55.       Left            =   315
  56.       TabIndex        =   21
  57.       Top             =   3300
  58.       Width           =   885
  59.    End
  60.    Begin Label JMsg 
  61.       BorderStyle     =   1  'Fixed Single
  62.       Height          =   465
  63.       Left            =   3765
  64.       TabIndex        =   22
  65.       Top             =   3000
  66.       Width           =   1455
  67.    End
  68.    Begin Label JstartJ 
  69.       BackColor       =   &H00C0C0C0&
  70.       Height          =   225
  71.       Left            =   2520
  72.       TabIndex        =   24
  73.       Top             =   2835
  74.       Width           =   1065
  75.    End
  76.    Begin Label Label11 
  77.       BackColor       =   &H00C0C0C0&
  78.       Caption         =   "Start Date:"
  79.       Height          =   225
  80.       Left            =   315
  81.       TabIndex        =   20
  82.       Top             =   2850
  83.       Width           =   960
  84.    End
  85.    Begin Label Label13 
  86.       BackColor       =   &H00C0C0C0&
  87.       Caption         =   "Julian Date"
  88.       Height          =   195
  89.       Left            =   2535
  90.       TabIndex        =   23
  91.       Top             =   2595
  92.       Width           =   1065
  93.    End
  94.    Begin Label Label10 
  95.       BackColor       =   &H00C0C0C0&
  96.       Caption         =   " Julian Dating"
  97.       Height          =   210
  98.       Left            =   465
  99.       TabIndex        =   19
  100.       Top             =   2385
  101.       Width           =   1245
  102.    End
  103.    Begin Label Label9 
  104.       BackColor       =   &H00C0C0C0&
  105.       Caption         =   "Label9"
  106.       Height          =   195
  107.       Left            =   3840
  108.       TabIndex        =   18
  109.       Top             =   1980
  110.       Width           =   1260
  111.    End
  112.    Begin Label Label7 
  113.       BackColor       =   &H00C0C0C0&
  114.       Caption         =   "Current Ticks:"
  115.       Height          =   195
  116.       Left            =   2430
  117.       TabIndex        =   17
  118.       Top             =   1965
  119.       Width           =   1290
  120.    End
  121.    Begin Label DTLbl 
  122.       BackColor       =   &H00C0C0C0&
  123.       Caption         =   "Label9"
  124.       ForeColor       =   &H00FF0000&
  125.       Height          =   210
  126.       Index           =   5
  127.       Left            =   1560
  128.       TabIndex        =   10
  129.       Top             =   1995
  130.       Width           =   420
  131.    End
  132.    Begin Label DTLbl 
  133.       BackColor       =   &H00C0C0C0&
  134.       Caption         =   "Label7"
  135.       ForeColor       =   &H00FF0000&
  136.       Height          =   195
  137.       Index           =   4
  138.       Left            =   1560
  139.       TabIndex        =   9
  140.       Top             =   1785
  141.       Width           =   420
  142.    End
  143.    Begin Label TLbl 
  144.       BackColor       =   &H00C0C0C0&
  145.       Caption         =   "Label10"
  146.       Height          =   195
  147.       Index           =   3
  148.       Left            =   4425
  149.       TabIndex        =   16
  150.       Top             =   1500
  151.       Width           =   330
  152.    End
  153.    Begin Label DTLbl 
  154.       BackColor       =   &H00C0C0C0&
  155.       Caption         =   "Label6"
  156.       ForeColor       =   &H00FF0000&
  157.       Height          =   195
  158.       Index           =   3
  159.       Left            =   1560
  160.       TabIndex        =   8
  161.       Top             =   1500
  162.       Width           =   435
  163.    End
  164.    Begin Label TLbl 
  165.       BackColor       =   &H00C0C0C0&
  166.       Caption         =   "Label9"
  167.       Height          =   195
  168.       Index           =   2
  169.       Left            =   4425
  170.       TabIndex        =   15
  171.       Top             =   1305
  172.       Width           =   330
  173.    End
  174.    Begin Label DTLbl 
  175.       BackColor       =   &H00C0C0C0&
  176.       Caption         =   "Label5"
  177.       ForeColor       =   &H00FF0000&
  178.       Height          =   195
  179.       Index           =   2
  180.       Left            =   1560
  181.       TabIndex        =   7
  182.       Top             =   1305
  183.       Width           =   420
  184.    End
  185.    Begin Label TLbl 
  186.       BackColor       =   &H00C0C0C0&
  187.       Caption         =   "Label7"
  188.       Height          =   195
  189.       Index           =   1
  190.       Left            =   4425
  191.       TabIndex        =   14
  192.       Top             =   1125
  193.       Width           =   330
  194.    End
  195.    Begin Label DTLbl 
  196.       BackColor       =   &H00C0C0C0&
  197.       Caption         =   "Label4"
  198.       ForeColor       =   &H00FF0000&
  199.       Height          =   195
  200.       Index           =   1
  201.       Left            =   1545
  202.       TabIndex        =   6
  203.       Top             =   1110
  204.       Width           =   435
  205.    End
  206.    Begin Label Label6 
  207.       BackColor       =   &H00C0C0C0&
  208.       Caption         =   " WGLib Style"
  209.       Height          =   210
  210.       Left            =   3300
  211.       TabIndex        =   13
  212.       Top             =   870
  213.       Width           =   1170
  214.    End
  215.    Begin Label Label3 
  216.       BackColor       =   &H00C0C0C0&
  217.       Caption         =   " WGLib Format"
  218.       Height          =   210
  219.       Left            =   480
  220.       TabIndex        =   5
  221.       Top             =   855
  222.       Width           =   1305
  223.    End
  224.    Begin Label Label5 
  225.       BackColor       =   &H00C0C0C0&
  226.       Caption         =   "Label5"
  227.       Height          =   210
  228.       Left            =   4110
  229.       TabIndex        =   12
  230.       Top             =   450
  231.       Width           =   825
  232.    End
  233.    Begin Label Label4 
  234.       BackColor       =   &H00C0C0C0&
  235.       Caption         =   "BASIC Time:"
  236.       Height          =   240
  237.       Left            =   2955
  238.       TabIndex        =   11
  239.       Top             =   435
  240.       Width           =   1110
  241.    End
  242.    Begin Label Label2 
  243.       BackColor       =   &H00C0C0C0&
  244.       ForeColor       =   &H00000000&
  245.       Height          =   255
  246.       Left            =   1395
  247.       TabIndex        =   4
  248.       Top             =   450
  249.       Width           =   975
  250.    End
  251.    Begin Label Label1 
  252.       BackColor       =   &H00C0C0C0&
  253.       Caption         =   "BASIC Date:"
  254.       Height          =   255
  255.       Left            =   165
  256.       TabIndex        =   3
  257.       Top             =   450
  258.       Width           =   1095
  259.    End
  260. DefInt A-Z
  261. Sub Form_Load ()
  262.     Label2.Caption = Date$
  263.     Label5.Caption = Time$
  264.     JEnd.text = Date$
  265.     dow = DOSDate(m%, d%, yr%)
  266.     doy = DayOfYr()
  267.     DtLbl(1).Caption = Str$(m)
  268.     DtLbl(2).Caption = Str$(d)
  269.     DtLbl(3).Caption = LTrim$(Str$(yr))
  270.     DtLbl(4).Caption = Str$(dow)
  271.     DtLbl(5).Caption = Str$(doy)
  272.     errc = DOSTime(h, m, s)
  273.     TLbl(1).Caption = Str$(h)
  274.     TLbl(2).Caption = Str$(m)
  275.     TLbl(3).Caption = Str$(s)
  276.     t& = SysTicks&()
  277.     Label9.Caption = LTrim$(Str$(t&))
  278. End Sub
  279. Sub Form_Paint ()
  280.     DtFrm.ForeColor = QBColor(0)
  281.     CurrentX = 375
  282.     CurrentY = 1110
  283.     DtFrm.Print "Month:"
  284.     CurrentX = 375
  285.     CurrentY = 1305
  286.     DtFrm.Print "   Day:"
  287.     CurrentX = 375
  288.     CurrentY = 1515
  289.     DtFrm.Print "  Year:"
  290.     CurrentX = 260
  291.     CurrentY = 1800
  292.     DtFrm.Print "Day of Week:"
  293.     CurrentX = 260
  294.     CurrentY = 2010
  295.     DtFrm.Print "  Day of Year:"
  296.     CurrentY = 1110
  297.     CurrentX = 3135
  298.     Print "Hour:"
  299.     CurrentY = 1305
  300.     CurrentX = 3135
  301.     Print "  Min:"
  302.     CurrentY = 1500
  303.     CurrentX = 3135
  304.     Print " Sec:"
  305.     EmpressFrm DtFrm, 950, 205, 2300, 2100, 1
  306.     EmbossFrm DtFrm, 950, 3015, 1755, 4890, 1
  307.     EmpressFrm DtFrm, 2500, 240, 3715, 5400, 2
  308.     ConvexFrm DtFrm, 4
  309.     ConcaveCtl JMsg, 3
  310.     ConcaveCtl JStart, 3
  311.     ConcaveCtl JEnd, 3
  312.     ConcaveCtl JstartJ, 3
  313.     ConcaveCtl JEndJ, 3
  314.     JStart.SetFocus
  315. End Sub
  316. Sub JEnd_LostFocus ()
  317.     sd$ = LTrim$(RTrim$(JEnd.text))
  318.     If Len(sd$) = 10 Then
  319.         Call ParseDate(sd$, m, d, y)
  320.         j& = Julian(m, d, y)
  321.     End If
  322.     JEndJ.Caption = Str$(j&)
  323. End Sub
  324. Sub JStart_LostFocus ()
  325.     sd$ = LTrim$(RTrim$(JStart.text))
  326.     If Len(sd$) = 10 Then
  327.         Call ParseDate(sd$, m, d, y)
  328.         j& = Julian(m, d, y)
  329.     End If
  330.     JstartJ.Caption = Str$(j&)
  331. End Sub
  332. Sub JulCmd_Click ()
  333.      d$ = LTrim$(RTrim$(JStart.text))
  334.      If Len(d$) < 10 Then
  335.          msg$ = "Julian dates must be in the format 'mm/dd/yyyy'"
  336.          MsgBox msg$, 64, "Whoops"
  337.          JStart.SetFocus
  338.      End If
  339.      Call ParseDate(d$, smo, sda, syr)
  340.      
  341.      d$ = LTrim$(RTrim$(JEnd.text))
  342.      If Len(d$) < 10 Then
  343.          msg$ = "Julian dates must be in the format 'mm/dd/yyyy'"
  344.          MsgBox msg$, 64, "Whoops"
  345.          JEnd.SetFocus
  346.      End If
  347.      Call ParseDate(d$, emo, eda, eyr)
  348.      JBeg& = Julian(smo, sda, syr)
  349.      JEndd& = Julian(emo, eda, eyr)
  350.      DayDiff& = Abs(JEndd& - JBeg&)
  351.      JstartJ.Caption = Str$(JBeg&)
  352.      JEndJ.Caption = Str$(JEndd&)
  353.      JMsg.Caption = "The difference in days is" + Str$(DayDiff&) + "."
  354. End Sub
  355. Sub ParseDate (d$, mo, da, yr)
  356.     mo = Val(Left$(d$, 2))
  357.     yr = Val(Right$(d$, 4))
  358.     da = Val(Mid$(d$, 4, 2))
  359. End Sub
  360.